<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title></title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
  <link rel="stylesheet" href="/assets/library/core/css/front.css?v={:rand()}" />
  <script src="/assets/library/layui/layui.js?v={:rand()}"></script>
	<script src="/assets/library/core/core.js?v={:rand()}"></script>
  
</head>
<body>
  
  <div class="layui-layout-body layui-layout">
    <div class="layui-container">
      <div class="pear-row">
        <div class="pear-col-xs24 pear-col-md24">
          <div class="layui-tabs layui-hide-v" id="indexTabsHash">
            <ul class="layui-tabs-header">
              {volist name="subject" id="vo" key="key"}
              <li lay-id="sub{$vo.id}"  {eq name="key" value="0"} class="layui-this" {/eq}>{$vo.name}</li>
              {/volist}
            </ul>
            <div class="layui-tabs-body main-container">
              {volist name="subject" id="vo" key="key"}
              <div class="layui-tabs-item">
                <div class="pear-row layui-col-space5">
                  {volist name="vo['list']" id="v" key="k"}
                  <div class=" pear-col pear-col-xs24 pear-col-md12 pear-col">
                    <div class="index-tabs">
                      {if condition="isset($account['workers'][$vo['id'].'_'.$vo['list'][$k-1]['id']])"}
                      <div class="tabs-left desc">
                      <img src="/static/zw.jpg">
                      <div class="info">{$account['workers'][$vo['id'].'_'.$vo['list'][$k-1]['id']]}<span style="font-weight: 0;font-size: 18px;">%</span></div>
                      </div>
                      {else/}
                      <div class="tabs-left">
                        <img src="/static/wu.jpg">
                      </div>
                      {/if}
                      <div class="tabs-right">
                        <div class="title"><b>{$k}</b>.{$v.title}</div>
                        
                        {if condition="isset($account['workers'][$vo['id'].'_'.$vo['list'][$k-1]['id']]) && (config('site')['variant_rate'] elt $account['workers'][$vo['id'].'_'.$vo['list'][$k-1]['id']]) "} 
                        <div class="info">
                          <div></div>
                          <a class="pear-btn pear-btn-success" href="javascript:;" onclick="javascript:layer.msg('知识点已完成，请复习下一个知识点')">已完成</a>
                        </div>
                        {else/}
                        {if condition="(!isset($account['workers'][$vo['id'].'_'.$vo['list'][$k-1]['id']])) && $k neq '1' && !( isset($account['workers'][$vo['id'].'_'.$vo['list'][$k-2]['id']]) && (config('site')['variant_rate'] elt $account['workers'][$vo['id'].'_'.$vo['list'][$k-2]['id']]) ) "}
                        
                        <div class="info">
                          <i class="layui-icon layui-icon-lock" style="font-size: 60px;color:#f56c6c"></i>
                          <a class="pear-btn pear-btn-warming" href="javascript:;" onclick="javascript:layer.msg('知识点已锁定，请按顺序复习')">开始复习</a>
                        </div>
                        {else /}
                          {if condition="isset($account['workers'][$vo['id'].'_'.$vo['list'][$k-1]['id']])"}
                          <div class="info">
                            <div style="color:#f56c6c;font-size: 17px; font-weight: 400;">正确率低</div>
                            <a class="pear-btn pear-btn-warming" href="{:url('player')}?id={$v['id']}">开始复习</a>
                          </div>
                          {else/}
                          <div class="info">
                            <div></div>
                            <a class="pear-btn pear-btn-warming" href="{:url('player')}?id={$v['id']}">开始复习</a>
                          </div>
                          {/if}
                        {/if}
                        {/if}
                      </div>
                    </div>
                  </div>
                  {/volist}
                </div>
              </div>
              {/volist}
            </div>
          </div>
        </div>
      </div>
    </div>
</div>
  <script>
    layui.use(['jquery', 'layer','element'], function() {

        let tabs = layui.tabs;
        let INDEX_TABS_ID = 'indexTabsHash';
        let defaultIndex = localStorage.getItem('indexTabsHash') || 'sub{$subject[0]["id"]}'; // 默认选中的标签页索引或者刷新后的索引
        tabs.change('indexTabsHash', defaultIndex);
        tabs.on(`beforeChange(${INDEX_TABS_ID})`, function(data) {
          localStorage.setItem('indexTabsHash',data.to.headerItem.attr('lay-id'));
          console.log(localStorage.getItem('indexTabsHash'));
        });
    })
  </script>
</body>
</html>